// gotypes.h
#ifndef GOTYPES_H
#define GOTYPES_H

#include <vector>
#include <algorithm>

enum class Player {
    Black,
    White
};

inline Player OtherPlayer(Player player) {
    return (player == Player::Black) ? Player::White : Player::Black;
}

struct Point {
    int row;
    int col;

    Point(int r = 0, int c = 0) : row(r), col(c) {}

    std::vector<Point> neighbors() const {
        return {
            Point(row - 1, col),
            Point(row + 1, col),
            Point(row, col - 1),
            Point(row, col + 1)
        };
    }

    bool operator==(const Point& other) const {
        return row == other.row && col == other.col;
    }

    bool operator<(const Point& other) const {
        if (row != other.row)
            return row < other.row;
        return col < other.col;
    }
};

// Hash function for Point to be used in unordered containers
struct PointHash {
    std::size_t operator()(const Point& p) const {
        return std::hash<int>()(p.row) ^ (std::hash<int>()(p.col) << 1);
    }
};

#endif // GOTYPES_H
